<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>6.slice和splice</title>
</head>

<body>
  <script>
    const arr = [10, 20, 30, 40, 50]

    // slice 纯函数
    const arr1 = arr.slice(1,4)
    const arr2 = arr.slice(1)
    const arr3 = arr.slice(-2)

    // splice 非纯函数

    // const spliceRes1 = arr.splice(1,2,'a','b','c')
    // const spliceRes1 = arr.splice(1,0,'a','b','c')
    // const spliceRes1 = arr.splice(1,2)



  </script>

</body>

</html>